Skip to content

Conversation

@Shreyas-Shankar155
Copy link
Contributor

Fix UART_NS16550_IRQ_FLAGS macro to recognize TI VIM interrupt-controller.

@github-actions github-actions bot added the area: UART Universal Asynchronous Receiver-Transmitter label Jul 10, 2025
@github-actions github-actions bot requested a review from dcpleung July 10, 2025 04:49
#define UART_NS16550_IRQ_FLAGS(n) \
COND_CODE_1(DT_INST_IRQ_HAS_CELL(n, sense), \
(DT_INST_IRQ(n, sense)), \
#ifdef CONFIG_DT_HAS_TI_VIM_ENABLED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use CONFIG_DT_HAS* in driver code. It maybe so that the UART instance does not have VIM as its parent, and yet, just the presence of VIM in the DT will set this to 1.

Copy link
Contributor Author

@Shreyas-Shankar155 Shreyas-Shankar155 Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've addressed this comment, but my solution is rather brute-force.
i'm searching if 'flags' exists, then if 'sense' exists.

however, if in the future, what to do if some new name has to be supported?
it wouldn't look too good if we have a chain of macros in this driver.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR intended to make it consistent: #80790. Maybe you can pick it up and rename all "sense" cells to "flags"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think its a good idea to rename all "sense" cells to "flags".

what if there are some drivers make assumptions that their compatible interrupt-controller use "sense"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core issue is making the driver care about the details of the interrupt-controller in the first place. What about interrupt-controllers that don't have a "type/sense/flags" cell at all? The interrupt-controller should provide a method to parse out the information it needs in a way that can be passed back to that interrupt-controller as it expects it. Having every end consumer driver do the DT parsing for the IRQ controller is never going to be flexible enough for all IRQ controllers.

@Shreyas-Shankar155 Shreyas-Shankar155 force-pushed the shrey/bugfix/uart_ns16550 branch from 4c880ba to 1dfa0a0 Compare July 10, 2025 06:33
Fix IRQ config to recognize TI VIM interrupt-controller

Signed-off-by: Shreyas Shankar <[email protected]>
@Shreyas-Shankar155 Shreyas-Shankar155 force-pushed the shrey/bugfix/uart_ns16550 branch from 1dfa0a0 to 35b0b18 Compare July 10, 2025 06:38
@sonarqubecloud
Copy link

@natto1784
Copy link
Contributor

natto1784 commented Jul 15, 2025 via email

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Sep 14, 2025
@github-actions github-actions bot closed this Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: UART Universal Asynchronous Receiver-Transmitter Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants